//  标准体重
import MeasureItem from './MeasureItem'

const UI = require('./UI')

var isAdd = false;
export default class StandWeightReport {

  static getStand(measure) {
    let weightControl;
    if (measure.user.gender == 'female') {
      weightControl = ((measure.user.hegiht * 1.37) - 110) * 0.45;
    } else {
      weightControl = (measure.user.hegiht - 80) * 0.7;
    }

    return weightControl;
  }

  static isEnable(measure) {
    return true
  }

  static build(measure) {
    
    const value = StandWeightReport.getStand(measure);
    let desc = '';
    const unit = "kg";
    const item = new MeasureItem();
    desc = "根据您的身高和年龄，您的标准体重是" + (+value).toFixed(1) + unit;
    item.key = 'standWeight'
    item.name = "标准体重";
    item.value = value;
    item.unit = unit;
    item.levelNames = ['标准'];
    item.bar = [UI.color.report_lower, UI.color.report_lowest];
    item.showBar = false;
    item.desc = desc;

    return item
  }

}
